<template>
    <div>
        <a-row :span="24">
            <a-col :span="18">
                <a-input-search v-model:value="positCategName" placeholder="请输入岗位信息"
                    style="width: 200px; margin-bottom: 10px" @search="onSearch()" />
            </a-col>
            <a-col :span="4">
                <a-dropdown :trigger="['click']">
                    <a class="ant-dropdown-link" :style="{ fontSize: '20px', color: 'black' }" @click.prevent>
                        <DashOutlined />
                    </a>
                    <template #overlay>
                        <a-menu>
                            <a-menu-item><a @click="expandAll">展开全部</a></a-menu-item>
                            <a-menu-item><a @click="collapseAll">折叠全部</a></a-menu-item>
                        </a-menu>
                    </template>
                </a-dropdown>
            </a-col>
        </a-row>

        <a-tree v-model:expandedKeys="expandedKeys" v-model:selectedKeys="selectedKeys" :tree-data="data" show-icon
            default-expand-all @select="openDash">
            <template #title="{ jobTypeName }">
                <TeamOutlined />
                {{ jobTypeName }}
            </template>
        </a-tree>
    </div>
</template>
<script setup>
import { TeamOutlined, DashOutlined } from '@ant-design/icons-vue';
import { queryList } from '../api/jobCategory'
const data = ref([])
const jobTypeName = ref('')
const query = ref({ pageNum: 1, pageSize: 10, sortBy: 'id' });
const props = defineProps({
    value: {
        type: [String, Number]
    }
})
const emit = defineEmits(['confirm'])

// 获取Tree
function buildWellTree() {
    queryList(query.value).then(res => {
        // console.log(res)
        data.value = res.content
    })
}
buildWellTree();
/** 节点单击事件 */
function openDash(key, e) {
    emit('confirm',key[0])
}

function onSearch() {

}
</script>